Fix duplication of Randomized Content Blocks - #7482
Conversation
|
Thanks for the pull request, @Kelketek! It looks like you're a member of a company that does contract work for edX. If you're doing this work as part of a paid contract with edX, you should talk to edX about who will review this pull request. If this work is not part of a paid contract with edX, then you should ensure that there is an OSPR issue to track this work in JIRA, so that we don't lose track of your pull request. To automatically create an OSPR issue for this pull request, just visit this link: http://openedx-webhooks.herokuapp.com/github/process_pr?repo=edx%2Fedx-platform&number=7482 |
00aac10 to
7d1d1ac
Compare
7d1d1ac to
21ee9d5
Compare
|
@marcotuts Care to take a look at this? @antoviaque Anyone else I should ping here? |
|
@Kelketek Yes, we need a second +1 -- we could ask someone else from solutions to look at this, but @bradenmacdonald since you investigated this originally and contributed to figuring out the fix, it might make sense for you to be the second reviewer - either now if you have the time, or on Monday as part of the next sprint. |
|
@antoviaque Having both @e-kolpakov and @bradenmacdonald review this would be nice, but since this is for the upstream platform, we'll need to make sure someone from upstream gives it a +1 as well. I have a feeling you're factoring in @marcotuts already for that, but I just want to be clear in case. :) |
|
(no comments from me on this and I generally won't review / thumbs up python fixes myself. That being said, I think it's ok if the second review is another member of this team. @antoviaque can make the call there.) |
|
@Kelketek I meant to have Braden as the second reviewer, it was mainly library-specific changes so it would have made sense - but on a second look, the change to |
There was a problem hiding this comment.
@Kelketek @bradenmacdonald Is that still the case? Wouldn't it be cleaner to delegate the duplication to the modulestore?
There was a problem hiding this comment.
@antoviaque That would not work because the modulestore is not aware of the structure of the overrides. There is no function for doing what we want in the modulestore directly. But the existing library_tools and a loop to copy the overrides works fine.
|
Tested again. 👍 from me if you fix that |
|
Thanks for the pull request, @Kelketek! It looks like you're a member of a company that does contract work for edX. If you're doing this work as part of a paid contract with edX, you should talk to edX about who will review this pull request. If this work is not part of a paid contract with edX, then you should ensure that there is an OSPR issue to track this work in JIRA, so that we don't lose track of your pull request. To automatically create an OSPR issue for this pull request, just visit this link: http://openedx-webhooks.herokuapp.com/github/process_pr?repo=edx%2Fedx-platform&number=7482 |
101857b to
fa95d32
Compare
There was a problem hiding this comment.
You don't necessarily need to add head_validation as an explicit argument here, but I guess it makes the possibilities more clear to people reading the code.
Edit: the downside is, you're specifying the default value in many different places.
|
@Kelketek Oh, I was so close to giving you a thumbs up... But then I found a bug. Here's a test case for it: a2cc1d5a1c58ee444a9f13251374e4f625a5ade0 I tried looking at the cause and have half of a fix for your consideration here: 433c7d9ad4e5bd300ea89c253ec0f92cd638ad09 (open-craft/fix_duplicate_rcb_review) - you need to change it so that copy_from_template accepts |
|
@bradenmacdonald Thanks a lot for the careful review. Once the issue you've found is fixed, we'll technically have 2 +1 on the PR, but given the scope I originally thought of also involving platform in the review. Do you think that's still necessary? How confident are you and @Kelketek about the fix? @cpennington Would you want to review this? Not sure if you had seen my ping on this PR earlier this week. I'm asking because we are getting close to the next release, so if we need a review from platform it's starting to be very tight - we would basically need a review today. :/ |
There was a problem hiding this comment.
Optional: If you're giving XBlocks the ability to control duplication, perhaps it would be better to add the default code (which is currently in this method) as a global default in studio (by adding it to the StudioMixin), and then letting individual blocks override. That way, you don't have to check if the children are handled or not. This code can just always call studio_post_duplicate, and assume that the block is doing the right thing.
|
Thanks, @cpennington . I'm testing the changes I made for Braden's notes now, and will work yours on top of those. I hope to have new changes pushed within an hour or so. |
|
@cpennington I have chosen to address only your non-optional suggestions in the interest of time. Please take a look at the current changes, and if they're ok and tests pass, I will rebase to squash the commits and merge. |
|
Ah, and if @bradenmacdonald gives his +1 as well. |
|
@Kelketek I'd like to at least track the option of providing a default |
|
@cpennington Alright, I'll go and hit it now. In the meantime, can you confirm the other issues are fine? I'll ping you once more as I get that change pushed. May as well do it now. |
|
@cpennington The function is recursive normally, and that function is a private function of that module. Are you sure? |
|
If so, because of those conditions, I am going to have to track it after all instead of fixing it now. But I did find one of my changes didn't make it into the commit, so I have just pushed that as well. I'll make that item in the tracker if you like. |
|
Yes, I think moving it out as a private function is still clearer than having it nested (even with the recursion). |
|
I'm 👍, as long as making |
|
@cpennington I've created a task in platform for this. Not sure I made the ticket quite right (or if that's the best place for it), but I've pinged you on it. |
|
👍 |
|
Thanks @bradenmacdonald and @cpennington ! |
Fix duplication of Randomized Content Blocks
Description: Fixes data loss issues when copying a Randomized Content Block
Jira Ticket: SOL-549
Partner Information: 3rd party-hosted open edX instance, for an edX solutions client.